import json
import requests
import datetime

import common

# 验证
def snCheck():
    mac = common.get_mac()
    # print(mac)

    url = "http://asorder.pro.aisisoft.com.cn/api/Index/getInfo?mac=" + mac
    response = requests.get(url)

    if response.status_code == 200:
        result = json.loads(response.text)
        # print("result", result)

        status = result['status']
        data = result['data']

        if status == 1:
            timestamp = data["over_time"]
            date = datetime.datetime.fromtimestamp(timestamp)
            formatted_date = date.strftime('%Y-%m-%d')
            return formatted_date
        
    return False
